package File文件操作;

import java.io.File;

public class Num3 {
    /*
    * 删除一个多级文件夹
    * */
    public static void main(String[] args) {
        File file = new File("C:\\Users\\gdq\\OneDrive\\桌面\\File文件夹\\aaa");
        delete(file);

    }
    public static void delete(File file){
        File f = file;
        while (!f.delete()){
            File[] f1 = file.listFiles();
            for (int i = 0; i < f1.length; i++) {
                if (!f1[i].delete()){
                    delete(f1[i]);
                }
            }
        }
        return;
    }
}
